﻿@*@model Super.Entity.User
@{
    Layout = "~/Areas/Admin/Views/Shared/_PopLayout.cshtml";
}
<article class="page-container">
    <form class="form form-horizontal" id="form-admin-add" action="/admin/user/edit" method="post">
        <input hidden="" value="@Model.Id" id="id" name="id" />
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">账号：</label>
            <div class="formControls col-xs-8 col-sm-10">
                <input type="text" class="input-text" value="@Model.Account" placeholder="" id="account" name="account">
            </div>
        </div>
        @{
            if (Model.Id <= 0)
            {
                <div class="row cl">
                    <label class="form-label col-xs-4 col-sm-2">密码：</label>
                    <div class="formControls col-xs-8 col-sm-10">
                        <input type="password" class="input-text" value="@Model.PassWord" placeholder="" id="password" name="password">
                    </div>
                </div>
            }
        }
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">地址：</label>
            <div class="formControls col-xs-8 col-sm-10">
                <input type="text" class="input-text" value="@Model.Address" placeholder="" id="address" name="address">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">手机号：</label>
            <div class="formControls col-xs-8 col-sm-10 skin-minimal">
                <input type="text" class="input-text" value="@Model.Mobile" placeholder="" id="mobile" name="mobile">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">上传头像：</label>
            <div class="formControls col-xs-8 col-sm-10">
                <div class="uploader-list-container">
                    <div class="queueList">
                        <div id="dndArea" class="placeholder">
                            <div id="filePicker-2"></div>
                            <p>或将照片拖到这里，单次最多可选300张</p>
                            <input type="hidden" name="licenseImg" value="" id="uploaderImg" />
                        </div>
                    </div>
                    <div class="statusBar" style="display:none;">
                        <div class="progress"> <span class="text">0%</span> <span class="percentage"></span> </div>
                        <div class="info"></div>
                        <div class="btns">
                            <div id="filePicker2"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">是否管理员：</label>
            <div class="formControls col-xs-8 col-sm-10 skin-minimal">
                @{
                    if (Model.IsAdmin)
                    {
                        <div class="radio-box">
                            <input name="admin" type="radio" id="admin-1" value="@Model.IsAdmin.ToString().ToLower()" checked="checked">
                            <label for="admin-1">是</label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="admin-2" value="false" name="admin">
                            <label for="admin-2">否</label>
                        </div>
                    }
                    else
                    {
                        <div class="radio-box">
                            <input name="admin" type="radio" id="admin-1" value="true">
                            <label for="admin-1">是</label>
                        </div>
                        <div class="radio-box">
                            <input type="radio" id="admin-2" name="admin" checked="checked" value="@Model.IsAdmin.ToString().ToLower()">
                            <label for="admin-2">否</label>
                        </div>
                    }
                }
            </div>
        </div>
        <div class="row cl">
            <div class="col-xs-8 col-sm-5 col-xs-offset-4 col-sm-offset-5">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>

</article>
<script type="text/javascript">
    $(function () {
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });
        $("#form-admin-add")
            .validate({
                rules: {
                    account: {
                        required: true,
                        minlength: 6,
                        maxlength: 32,
                        remote: {
                            type: "POST",
                            url: "/admin/user/validateAccount/?Id=" + $("#id").val()+"&acco="+$("#account").val(),
                            data: {
                                name: function () { return $("#account").val() }
                            }
                        }
                    },
                    password: {
                        required: true,
                        maxlength: 64
                    },
                    mobile: {
                        required: true,
                        isMobile: true
                    },
                    address: {
                        required: true
                    },
                    isadmin: {
                        required: true
                    }
                },
                messages: {
                    account: {
                        remote: "用户名已经被注册"
                    }
                },
                onkeyup: false,
                focusCleanup: true,
                success: "valid"

            });
    });
    init_uploader(1);//参数为限制上传的图片数量
</script>*@
